<template>
  <tm-app>
    <tm-navbar title="提现记录" :followTheme="true" :hideHome="true">
    </tm-navbar>
    <ad unit-id="adunit-d4b8c8d47ec6365b"></ad>
    <tm-sheet
      :padding="[0]"
      :margin="[20, 10, 20, 10]"
      :round="4"
      :transprent="true"
    >
      <tm-sheet
        :padding="[20]"
        :margin="[20, 10, 20, 10]"
        :round="4"
        v-for="item in state.list"
        :key="item.id"
      >
        <tm-text color="#666">提现金额: {{ item.mentionAmount }}</tm-text>
        <tm-text color="#666" _class="my-n3"
          >提现时间: {{ item.mentionDateTime }}</tm-text
        >
        <tm-text color="#666"
          >提现状态：{{ state.status[item.mentionStatus] }}</tm-text
        >
      </tm-sheet>
    </tm-sheet>
    <tm-message ref="msg"></tm-message>
  </tm-app>
</template>

<script setup>
import { onMounted, reactive, ref } from "vue";
import { getMentionRecordListApi } from "@/api";
import { onReachBottom } from "@dcloudio/uni-app";
const msg = ref(null);

const state = reactive({
  list: [],
  page: {
    pageNo: 1,
    pageSzie: 10,
  },
  total: 0,

  status: {
    stay: "待审核",
    yes: "通过",
    no: "不通过",
  },
});

onMounted(async () => {
  getMentionRecordList();
});
const getMentionRecordList = async () => {
  if (state.total != 0 && state.total == state.list.length) return;
  const res = await getMentionRecordListApi(state.page);
  state.list.push(...res.records);
  state.total = res.total;
};
onReachBottom(() => {
  if (state.total == state.list.length) return;
  state.page.pageNo += 1;
  getMentionRecordList();
});
</script>

<style scoped></style>
